﻿using System;
using System.Collections.Generic;

namespace Problem001
{
    static class IntListExtensions
    {
        public static double AddValues(this IList<int> list)
        {
            double sum = 0;

            foreach (var i in list)
            {
                sum += i;
            }
            return sum;
        }
    }

    class Program
    {
        private static readonly int maxNumber = 1000;

        static void Main()
        {
            Func<int, bool> isMultiple = x => (0 == (x%3)) || (0 == (x%5));

            IList<int> validNumbers = new List<int>();

            for(int number = 0; number < maxNumber; number++)
            {
                if (isMultiple(number))
                    validNumbers.Add(number);
            }

            Console.WriteLine(validNumbers.AddValues());
            Console.ReadKey();
        }
    }
}
